package zuoye2;

import java.util.Scanner;

public class Demo12 {
    public static void main(String[] args) {
        System.out.println("输入一个整数：");
        int n = new Scanner(System.in).nextInt();
        String str = "";
        while (n!=0){
            if (n%2!=0){
                str="1"+str;
            }else {
                str="0"+str;
            }
            n = n/2;
        }
        System.out.println("二进制输出为：" + str);
    }
}
